package com.dc.exceptions;


import com.dc.constat.StatusCodeConstants;

public class MyBaseException extends RuntimeException {

    private static final long serialVersionUID = 3961436702755913019L;

    /**
     * 异常编码
     */
    private int code;


    public MyBaseException(String message) {
        super(message);
        this.code = StatusCodeConstants.FAIL;
    }


    /**
     * 自定义异常信息格式
     * @return
     */
    protected String getErrorMessage() {
        return "[" + this.code + ":" + super.getMessage() + "]";
    }


    protected int getCode() {
        return this.code;
    }

}